package com.hotel.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author 夏智力
 * @FileName OrderIdByTimeUtil
 * @date 2021/6/24 14:35
 * @Software: IntelliJ IDEA
 */
public class OrderIdByTimeUtil {
    public static String getOrderIdByTime(int userId) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = sdf.format(new Date());
        String result = "";
        Random random = new Random();
        for(int i = 0;i < 3;i ++){
            result += random.nextInt(10);
        }
        return userId + newDate + result;
    }
}
